package com.mxprojects.constructors
{
	import flash.display.MovieClip;
	
	public class ProgressBar extends MovieClip
	{		
		public var background:MovieClip;
		public var bar:MovieClip;
		
		private var finish:Number;
		
		public function ProgressBar(finishAmount:Number, width:int = 200){
			//setup shop
			background.width = width;
			bar.width = 0;
			finish = finishAmount;
		}
		
		public function update(currentProgress:Number):void {
			//take the current progress and compare against the final 
			//to see how far we need to move the bar
			bar.width = background.width * currentProgress / finish;
			
			//hide the progress bar if we've hit the max
			if(currentProgress == finish){
				visible = false;
			}
		}

	}
}